/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package appagenda;

import javax.microedition.lcdui.Choice;
import javax.microedition.lcdui.ChoiceGroup;
import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.Form;
import javax.microedition.lcdui.Item;


/**
 *
 * @author luis
 */
public class FrmInicial extends Form implements CommandListener {

    private Agenda mid;
    public Command opcSair;
    public Command opcEscolher;
    public ChoiceGroup cgrpMenu;
    public Command cmVoltar, cmAjuda, cmAgendarEvento, cmConsultarEvento, cmExcluirEvento;
    
    public FrmInicial(String title, Agenda mid) {
        super(title);
        this.mid = mid;
        cmVoltar = new Command("Voltar", Command.BACK,0);
        cmAjuda = new Command("Ajuda", Command.ITEM,1);
        cmAgendarEvento = new Command("Agendar", Command.ITEM,2);
        cmConsultarEvento = new Command("Consultar", Command.ITEM,3);
        cmExcluirEvento = new Command("Excluir", Command.ITEM,4);
        this.addCommand(cmVoltar);
        this.addCommand(cmAjuda);
        this.addCommand(cmAgendarEvento);
        this.addCommand(cmConsultarEvento);
        this.addCommand(cmExcluirEvento);
        
        this.setCommandListener(this);
    }

    public void commandAction(Command c, Displayable d) {
        if (c == opcSair) {
            mid.destroyApp(true);
            mid.notifyDestroyed();
              
        }else if(c==cmAgendarEvento){
            Display display = Display.getDisplay(mid);
            display.setCurrent(new FrmEvento("Cadastro de Eventos",this , mid));
        }else if(c==cmConsultarEvento){
            Display display = Display.getDisplay(mid);
            //display.setCurrent(new FrmEventoMSG("Consulta de Eventos",this , mid));
            
            //eventoDAO.todos();
                
            
            System.out.println("CONSULTA DE EVENTO");
        }else if(c==cmVoltar){
            //Display display = Display.getDisplay(mid);
            //display.setCurrent(new FrmEvento("Cadastro de Eventos",this , mid));
        
            System.out.println("BOTAO VOLTAR!");
        }
        
    }
}
